<html>
<head><meta charset="utf-8"><title>match candidate priority order · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/match.20candidate.20priority.20order.html">match candidate priority order</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="223846690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/match%20candidate%20priority%20order/near/223846690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/match.20candidate.20priority.20order.html#223846690">(Jan 25 2021 at 01:08)</a>:</h4>
<p>Do higher-priority match <code>Candidate</code>s come first or last? The documentation is inconsistent:</p>
<p><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_build/build/struct.Builder.html#method.match_candidates"><code>Builder::match_candidates</code></a> says:</p>
<blockquote>
<p>The candidates are sorted such that the first item in the list has the highest priority.</p>
</blockquote>
<p>while <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_build/build/struct.Builder.html#method.test_candidates"><code>Builder::test_candidates</code></a> says:</p>
<blockquote>
<p>To decide what test to do, we take the highest priority candidate (last one in the list)</p>
</blockquote>
<p>Which one is correct? Or is it context-dependent what the ordering is?</p>



<a name="223848320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/match%20candidate%20priority%20order/near/223848320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/match.20candidate.20priority.20order.html#223848320">(Jan 25 2021 at 01:48)</a>:</h4>
<p>cc <a href="https://github.com/rust-lang/rust/issues/81364">#81364</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>